package rs.udd.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import rs.udd.model.Advert;

public interface AdvertRepository extends JpaRepository<Advert, Long> {

	@Query("SELECT a FROM Advert a JOIN a.categories c WHERE c.name LIKE :categoryName")
	public List<Advert> findAdvertsByCategory(@Param("categoryName") String categoryName);

	public Advert findByIndexedDocumentId(String indexedDocumentId);
	
	public Advert findByFilePath(String filePath);
	
}
